/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ericsson.nfc.signing.algorithm;

/**
 *
 * @author emarkki
 */
public class ImplementationDetector {
    
    private static ImplementationDetector instance;
    
    private boolean useSatsa = true;
    private boolean run = false;
    
    public static ImplementationDetector getInstance() {
        if(instance == null) {
            instance = new ImplementationDetector();
        }
        return instance;
    }
    
    public boolean isSatsaAvailable() {
        
        if(!useSatsa) {
            return false;
        }

        if(!run) {
            try {
                Class.forName("javax.crypto.NoSuchPaddingException");
                useSatsa = true;
            } catch(ClassNotFoundException ex) {
                useSatsa = false;
            }
        }
        return useSatsa;
    }

    public void setUseSatsa(boolean useSatsa) {
        this.useSatsa = useSatsa;
    }
    
}
